This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# put this function in some file that will be loaded into your bash profile | |
# I personally use a dedicated sourced file for functions but it could also be placed | |
# in your .bashrc, .profile, or .bash_profile | |
# Usage: | |
# at a bash prompt, run | |
# migrate-repo <repo-url> | |
# the repo url could look like [email protected]:username/repo-name.git | |
function migrate-repo() { | |
new_repo_url=$1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React from 'react'; | |
import PropTypes from 'prop-types'; | |
import SyntaxHighlighter from 'react-syntax-highlighter'; | |
export default class CodeBlock extends React.PureComponent { | |
static propTypes = { | |
value: PropTypes.string.isRequired, | |
language: PropTypes.string, | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var gulp = require('gulp'); | |
var source = require('vinyl-source-stream'); | |
var buffer = require('vinyl-buffer'); | |
var watch = require('gulp-watch'); | |
var gutil = require('gulp-util'); | |
var browserify = require('browserify'); | |
var babel = require('gulp-babel'); | |
gulp.task('transform', function() { | |
return gulp.src('./app/src/**/*.jsx') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- name: Download Telegram | |
shell: "wget https://tdesktop.com/linux -O telegram.tar.xz" | |
args: | |
chdir: "./bootstrap/files" | |
creates: "telegram.tar.xz" | |
- name: Unarchive Telegram | |
sudo: yes | |
unarchive: src=telegram.tar.xz dest=/opt |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ErrorActionPreference = "Stop" | |
$notificationTitle = "Notification: " + [DateTime]::Now.ToShortTimeString() | |
[Windows.UI.Notifications.ToastNotificationManager, Windows.UI.Notifications, ContentType = WindowsRuntime] > $null | |
$template = [Windows.UI.Notifications.ToastNotificationManager]::GetTemplateContent([Windows.UI.Notifications.ToastTemplateType]::ToastText01) | |
#Convert to .NET type for XML manipuration | |
$toastXml = [xml] $template.GetXml() | |
$toastXml.GetElementsByTagName("text").AppendChild($toastXml.CreateTextNode($notificationTitle)) > $null |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add-Type -AssemblyName System.Windows.Forms | |
while ($true) | |
{ | |
$Pos = [System.Windows.Forms.Cursor]::Position | |
$x = ($pos.X % 500) + 1 | |
$y = ($pos.Y % 500) + 1 | |
[System.Windows.Forms.Cursor]::Position = New-Object System.Drawing.Point($x, $y) | |
Start-Sleep -Seconds 10 | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# bash generate random alphanumeric string | |
# | |
# bash generate random 32 character alphanumeric string (upper and lowercase) and | |
NEW_UUID=$(cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w 32 | head -n 1) | |
# bash generate random 32 character alphanumeric string (lowercase only) | |
cat /dev/urandom | tr -dc 'a-z0-9' | fold -w 32 | head -n 1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import paramiko | |
k = paramiko.RSAKey.from_private_key_file("/Users/whatever/Downloads/mykey.pem") | |
c = paramiko.SSHClient() | |
c.set_missing_host_key_policy(paramiko.AutoAddPolicy()) | |
print "connecting" | |
c.connect( hostname = "www.acme.com", username = "ubuntu", pkey = k ) | |
print "connected" | |
commands = [ "/home/ubuntu/firstscript.sh", "/home/ubuntu/secondscript.sh" ] | |
for command in commands: | |
print "Executing {}".format( command ) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# | |
# autosshd This script starts and stops the autossh daemon | |
# | |
# chkconfig: 2345 95 15 | |
# processname: autosshd | |
# description: autosshd is the autossh daemon. | |
# Source function library. | |
. /etc/rc.d/init.d/functions |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
# Reflects the requests from HTTP methods GET, POST, PUT, and DELETE | |
# Written by Nathan Hamiel (2010) | |
from BaseHTTPServer import HTTPServer, BaseHTTPRequestHandler | |
from optparse import OptionParser | |
class RequestHandler(BaseHTTPRequestHandler): | |
def do_GET(self): |
NewerOlder