Skip to content

Instantly share code, notes, and snippets.

@snakewa
snakewa / cool.md
Last active June 13, 2025 10:15
Cool
@snakewa
snakewa / gist:77d80fd6e1d01209ddab
Created October 14, 2015 06:05
find 8080's proc
netstat -tulpn | grep :8080
@snakewa
snakewa / add_remote_authorized_key.sh
Created October 14, 2015 04:10
Add local's ssh pubkey to remote's authorized_keys file (create if not exists)
#usage add_remote_authorized_key ~/.ssh/your_pub_key user@someremoteserver
cat $1 | ssh $2 "mkdir ~/.ssh;cat >> ~/.ssh/authorized_keys;chmod 600 ~/.ssh/authorized_keys"
@snakewa
snakewa / goal.js
Last active August 29, 2015 14:05
javascript solution of g()('al')
//
// possible one of the solution of g()('al') challenge.
// http://thechangelog.com/can-your-favorite-programming-language-score-a-goal/?utm_source=rss&utm_medium=rss&utm_campaign=can-your-favorite-programming-language-score-a-goal
//
function g(last){
if(typeof i =="undefined") i=-1;
i++;
if(last){
var s= (""+Math.pow(10,i) ).replace(/1/gi,"g").replace(/0/gi,"o")+last
delete i;
@snakewa
snakewa / php_basic.php
Created March 20, 2012 06:04
php basic
<?php
echo "cm320.2<br>\n";
echo "PHP and MySQL<br>\n";
?>
<h2>Hello <?php echo $_GET['name']; ?><h2>
<?php
$basic_height = 200;
@snakewa
snakewa / gist:1993627
Created March 7, 2012 14:55
Install Sublime Text 2 command line
ln -s "/Applications/Sublime Text 2.app/Contents/SharedSupport/bin/subl" /usr/local/bin/subl
find target_folder -type f -mtime -1 | xargs tar cvf update_`date +%Y-%m-%d`.tar.gz --exclude *.tmp
@snakewa
snakewa / list-files.js
Created November 30, 2010 10:13
list all files in node.js
var fs = require('fs'),
_ = require('underscore')._;
var files = {};
_(fs.readdirSync('.')).each(function(v,k){
fs.stat(v,function(err,stat){
if(stat.isDirectory()){
_(fs.readdirSync(v)).each(function(file){
//if(file!=file.toLowerCase()){
//fs.renameSync(v+"/"+file,v+"/"+file.toLowerCase());
//}
update palm_log set palm_min = FROM_UNIXTIME(unix_timestamp(palm_time) - unix_timestamp(palm_time) % 60)
# This patch file was generated by NetBeans IDE
# It uses platform neutral UTF-8 encoding and \n newlines.
--- ahDoctrineEasyEmbeddedRelationsPlugin/lib/form/ahBaseFormDoctrine.class.php
+++ ahDoctrineEasyEmbeddedRelationsPlugin/lib/form/ahBaseFormDoctrine.class.php
@@ -30,7 +30,8 @@
'newFormsContainerForm' => null, // pass BaseForm object here or we will create ahNewRelationsContainerForm
'newRelationButtonLabel' => '+',
'newRelationAddByCloning' => true,
- 'newRelationUseJSFramework' => 'jQuery'
+ 'newRelationUseJSFramework' => 'jQuery',