Skip to content

Instantly share code, notes, and snippets.

Avatar
🦀

Brahm Lower bplower

🦀
View GitHub Profile
@jasonwarta
jasonwarta / migrate-git-repo.sh
Last active Jan 6, 2019
script for migrating a git repo between services
View migrate-git-repo.sh
# 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 git@github.com:username/repo-name.git
function migrate-repo() {
new_repo_url=$1
@ibrahima
ibrahima / CodeBlock.jsx
Last active Dec 3, 2020
Syntax highlighting for react-markdown
View CodeBlock.jsx
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,
}
@micmania1
micmania1 / gulpfile.js
Last active Jul 21, 2020
Basic react gulpfile with browserfy and babel
View gulpfile.js
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')
View gist:ffb16494d0857e13fc6c
- 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
@altrive
altrive / ToastNotification_Windows10.ps1
Last active Feb 26, 2021
Windows 10 toast notification sample
View ToastNotification_Windows10.ps1
$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
@MatthewSteeples
MatthewSteeples / mousemove.ps1
Created Feb 26, 2015
Powershell Script to keep the mouse moving
View mousemove.ps1
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
}
@earthgecko
earthgecko / bash.generate.random.alphanumeric.string.sh
Last active Feb 26, 2021
shell/bash generate random alphanumeric string
View bash.generate.random.alphanumeric.string.sh
#!/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-zA-Z0-9' | fold -w 32 | head -n 1
@batok
batok / paramiko_example.py
Created Apr 10, 2012
Paramiko example using private key
View paramiko_example.py
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 )
@qingshan
qingshan / autosshd
Created Jan 7, 2012
autosshd is the autossh daemon.
View autosshd
#!/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
@huyng
huyng / reflect.py
Created Feb 7, 2011
A simple echo server to inspect http web requests
View reflect.py
#!/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):