Skip to content

Instantly share code, notes, and snippets.

@mda590
mda590 / boto3_listinstances_example.py
Last active May 29, 2024 09:08
Example using boto3 to list running EC2 instances
import boto3
ec2 = boto3.resource('ec2')
def lambda_handler(event, context):
# create filter for instances in running state
filters = [
{
'Name': 'instance-state-name',
'Values': ['running']
@pixeline
pixeline / mirror_remote_directory_to_local_directory
Last active May 21, 2024 19:36
Bash script using lftp to mirror remote directory to local directory, thus keeping the local directory synchronized with the remote one.
#!/bin/sh
# @author: Alexandre Plennevaux
# @description: MIRROR DISTANT FOLDER TO LOCAL FOLDER VIA FTP
#
# FTP LOGIN
HOST='sftp://ftp.domain.com'
USER='ftpusername'
PASSWORD='ftppassword'
# DISTANT DIRECTORY
@tobert
tobert / 00-trivial-unix.fio
Last active August 29, 2015 14:00
trivial.fio output examples
[global]
ioengine=posixaio
rw=readwrite
size=1g
directory=${HOME}/fio # environment variable
thread=1
[trivial-readwrite-1g]
@octocat
octocat / .gitignore
Created February 27, 2014 19:38
Some common .gitignore configurations
# Compiled source #
###################
*.com
*.class
*.dll
*.exe
*.o
*.so
# Packages #
@yao2030
yao2030 / Hadamar.java
Created October 23, 2012 06:40
Hadamard matrix
public class Hadamard
{
public static void main(String[] args)
{
int N = Integer.parseInt(args[0]);
boolean[][] H = new boolean[N][N];
H[0][0] = true;
for(int n = 1; n < N; n += n)
{
for(int i = 0; i < n; i++)
@kogakure
kogakure / .gitignore
Last active December 17, 2023 08:21
Git: .gitignore file for LaTeX projects
*.acn
*.acr
*.alg
*.aux
*.bak
*.bbl
*.bcf
*.blg
*.brf
*.bst