Skip to content

Instantly share code, notes, and snippets.

View jyap808's full-sized avatar

Julian Y jyap808

View GitHub Profile
@jyap808
jyap808 / gist:8700714
Last active November 25, 2022 22:42
Rsync - via SSH with no password, utilizing SSH ForceCommand in the authorized_keys file to limit the commands that can be run with that SSH key

To make rsync both secure and automated (i.e : non-interactive), you can use SSH as the transport and set up a key pair. This is what will be discussed in this post, along with a few improvements.

Basic rsync + ssh

Let’s first ensure that rsync works correctly over ssh :

spaghetti% rsync -avz -e ssh --delete Documents prodigy:/tmp

Password:

@jyap808
jyap808 / gist:8703450
Created January 30, 2014 06:13
Resume another user's screen session

The problem: Being root you would like to resume another user's screen session. Let the user be A.

You 'become' him by

su A -

or

sudo su - A
@jyap808
jyap808 / gist:8924735
Created February 10, 2014 21:39
MySQLDump one INSERT statement for each data row
@jyap808
jyap808 / People_laurenz_dislikes.md
Last active August 29, 2015 13:56
People Laurenz dislikes
  • Kanye West
  • Edward Snowden
  • Floyd Mayweather Jr.
  • Jay Z
  • Uwe Bowell
  • WS Anderson
@jyap808
jyap808 / gist:8963001
Created February 12, 2014 19:40
Finding iowait culprits

As root:

/etc/init.d/syslog stop
echo 1 > /proc/sys/vm/block_dump
dmesg | egrep "READ|WRITE|dirtied" | egrep -o '([a-zA-Z]*)' | sort | uniq -c | sort -rn | head

Sample output

@jyap808
jyap808 / create_boot_usb_osx.md
Created February 19, 2014 00:04
Create a bootable USB stick on OS X

##Create a bootable USB stick on OS X

Convert the .iso file to .img using hdiutil

Note: OS X tends to put the .dmg ending on the output file automatically.

$ hdiutil convert -format UDRW -o target.img source.iso
Reading Master Boot Record (MBR : 0)…
Reading Ubuntu 13.10 i386                (Apple_ISO : 1)…
@jyap808
jyap808 / keybase.md
Created April 2, 2014 20:37
Keybase verification

Keybase proof

I hereby claim:

  • I am jyap808 on github.
  • I am jyap (https://keybase.io/jyap) on keybase.
  • I have a public key whose fingerprint is 685B 5017 6420 1448 6543 0475 C3BD 0552 7F66 1F0A

To claim this, I am signing this object:

@jyap808
jyap808 / Shrink MongoDB journal files.md
Created April 8, 2014 20:46
Shrink MongoDB journal files

In the MongoDB configuration file add the following line:

smallfiles=true

The safety shut off MongoDB and remove the journal files.

Full procedure:

@jyap808
jyap808 / Nginx Virtual Host Log Format.md
Created April 13, 2014 05:03
Nginx Virtual Host Log Format
$ diff -u /etc/nginx/nginx.conf{.ORIG,}
--- /etc/nginx/nginx.conf.ORIG  2014-04-13 04:15:51.907316500 +0000
+++ /etc/nginx/nginx.conf       2014-04-13 05:02:22.807316500 +0000
@@ -30,7 +30,9 @@
        # Logging Settings
        ##
 
-       access_log /var/log/nginx/access.log;
+ log_format vhosts '$host $remote_addr - $remote_user [$time_local] "$request" $status $body_bytes_sent "$http_referer" "$http_user_agent"';
@jyap808
jyap808 / mapCheckpoints and mapStakeModifierCheckpoints.md
Created June 12, 2014 06:46
mapCheckpoints and mapStakeModifierCheckpoints