Skip to content

Instantly share code, notes, and snippets.

@tomdyson
tomdyson / spartan-rules.md
Created December 6, 2010 15:55
President Yoshida's 10 Spartan Rules
  1. Create work for yourself; don’t wait for work to be assigned to you.

  2. Take an active role in all your endeavours, not a passive one.

  3. Seek out large and complex jobs. Trivial tasks debase you.

  4. Welcome difficult assignments. Choose them. Progress lies in accomplishing difficult work.

  5. Once you begin a task, complete it. Never give up.

@linkdd
linkdd / enter-chroot.bash
Created July 4, 2012 09:15
Script to manage chroot
#!/bin/bash
if [ "$UID" != "0" ]
then
echo "You have to be root" >&2
exit 1
fi
CHROOT=$1
<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
<xsl:output method="html" indent="yes" />
<xsl:template match="/">
<html>
<body>
<h1>Statistics</h1>
<p>Total codebase size: <xsl:value-of select="//CodebaseCost"/></p>
<p>Code to analyze: <xsl:value-of select="//TotalDuplicatesCost"/></p>
<p>Total size of duplicated fragments: <xsl:value-of select="//CodebaseCost" /></p>
@staltz
staltz / introrx.md
Last active July 8, 2024 15:46
The introduction to Reactive Programming you've been missing
@yuanying
yuanying / vagrant-kvm.md
Last active April 17, 2024 08:12
How to use vagrant-kvm

Install Vagrant

sudo su
apt-get update && apt-get install -y libvirt-dev ruby-all-dev apparmor-utils
curl -O -L https://dl.bintray.com/mitchellh/vagrant/vagrant_1.6.5_x86_64.deb
dpkg -i vagrant_1.6.5_x86_64.deb 
aa-complain /usr/lib/libvirt/virt-aa-helper # workaround
exit

Install vagrant-kvm as user

@diyan
diyan / gui_automation_python.md
Last active December 4, 2023 14:48
Desktop GUI automation in Python

Desktop

UI Automation. Desktop. Python

GUI toolkit agnostic

autopy - simple, cross-platform GUI automation toolkit. MIT - https://github.com/msanders/autopy/

  • 432 stars, 102 forks, 2950 monthly downloads at 2015-05-13
  • GUI toolkit agnostic
@DraTeots
DraTeots / HighResolutionTimerProfile.cs
Last active February 26, 2019 10:17
HighResolutionTimer test and profile
// profiling of HighResolutionTimer implementation
// https://gist.github.com/DraTeots/436019368d32007284f8a12f1ba0f545
using System;
using System.Diagnostics;
using System.Globalization;
using System.IO;
using System.Text;
using System.Threading;
@eddmann
eddmann / start-stop-ec2-instances.js
Created November 3, 2017 14:00
Scheduled Start/Stop of EC2 Instances using Lambda and CloudWatch Events
// Demonstration video can be found at: https://youtu.be/roAerKVfq-Y
// StopEC2Instance
const AWS = require('aws-sdk');
exports.handler = (event, context, callback) => {
const ec2 = new AWS.EC2({ region: event.instanceRegion });
ec2.stopInstances({ InstanceIds: [event.instanceId] }).promise()
#!/usr/bin/bash
which ansible >/dev/null 2>&1
if [ $? -ne 0 ];
then
echo "Installing Ansible..."
sleep 5
pushd .
cd ~
pacman -S libyaml-devel python2 tar libffi libffi-devel gcc pkg-config make openssl-devel openssh libcrypt-devel --noconfirm --needed
curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py
@alsibir
alsibir / # Vim Cheatsheet
Last active February 13, 2024 14:43
[.vim] vim #vim
# Vim Cheatsheet
>Disclaimer: This cheatsheet is summarized from personal experience and other online tutorials. It should not be considered as an official advice.
## Global
```bash
:help keyword # open help for keyword
:o file # open file
:saveas file # save file as
:close # close current pane