Skip to content

Instantly share code, notes, and snippets.

View amboxer21's full-sized avatar

Anthony Guevara amboxer21

  • Brick, New Jersey 08723
View GitHub Profile
#!/bin/bash
path="/usr/bin"
new_kernel_version=$1
current_kernel=`${path}/uname -r`
boot=`${path}/sudo ${path}/fdisk -l | ${path}/awk '/\/.*\*/{print $1}'`
cd /usr/src/linux-${new_kernel_version};
if [[ ! `${path}/mount | ${path}/egrep -io "^${boot} on /boot"` ]]; then
@Vicfred
Vicfred / nginx_uwsgi_flask_gentoo.md
Last active March 22, 2024 12:51
nginx + uwsgi + flask in gentoo and openrc

Instalacion

Instalamos los paquetes necesarios, primero nginx

# emerge -av www-servers/nginx

Para uwsgi que es un servidor hecho en C para aplicaciones en python (y otros) como no vamos a tener aplicaciones en Ruby o PHP vamos a quitarlos:

en /etc/portage/package.use/uwsgi agregamos:

I am using a micro SD Card and an adapter on Gentoo Linux. The SD Card device name is mmcblk0 with 2 partitions. mmcblk0p1 being the boot partition and mmcblk0p2 being the root partition.

Copy the system image to a blank SD Card

anthony@anthony ~ $ sudo dd if=/home/anthony/Documents/IMGs/rpi4b_system_image.img of=/dev/mmcblk0 status=progress bs=512
3218899456 bytes (3.2 GB, 3.0 GiB) copied, 564 s, 5.7 MB/s 
6291456+0 records in
6291456+0 records out
3221225472 bytes (3.2 GB, 3.0 GiB) copied, 573.351 s, 5.6 MB/s
anthony@anthony ~ $
@alphamu
alphamu / Android Privacy Policy Template
Created February 9, 2017 03:17
A template for creating your own privacy policy for Android apps. Look for "[" and "<!--" to see where you need to edit this app in order to create your own privacy olicy.
<html>
<body>
<h2>Privacy Policy</h2>
<p>[Individual or Company Name] built the [App Name] app as a [open source | free | freemium | ad-supported | commercial] app. This SERVICE is provided by [Individual or company name] [at no cost] and is intended
for use as is.</p>
<p>This page is used to inform website visitors regarding [my|our] policies with the collection, use, and
disclosure of Personal Information if anyone decided to use [my|our] Service.</p>
<p>If you choose to use [my|our] Service, then you agree to the collection and use of information in
relation with this policy. The Personal Information that [I|we] collect are used for providing and
improving the Service. [I|We] will not use or share your information with anyone except as described
@gunjanpatel
gunjanpatel / revert-a-commit.md
Last active June 11, 2024 19:48
Git HowTo: revert a commit already pushed to a remote repository

Revert the full commit

Sometimes you may want to undo a whole commit with all changes. Instead of going through all the changes manually, you can simply tell git to revert a commit, which does not even have to be the last one. Reverting a commit means to create a new commit that undoes all changes that were made in the bad commit. Just like above, the bad commit remains there, but it no longer affects the the current master and any future commits on top of it.

git revert {commit_id}

About History Rewriting

Delete the last commit

Deleting the last commit is the easiest case. Let's say we have a remote origin with branch master that currently points to commit dd61ab32. We want to remove the top commit. Translated to git terminology, we want to force the master branch of the origin remote repository to the parent of dd61ab32:

@mikkeloscar
mikkeloscar / guide.md
Created June 14, 2014 20:44
Setup armv7h chroot under x86_64 host (Archlinux/Archlinuxarm biased)

Setup armv7h chroot under x86_64 host (Archlinux/Archlinuxarm biased)

Simple way to setup an arm chroot for building packages for your arm devices. This is an alternative to cross-compiling where you are limited to only linking against the libs in your toolchain.

Setup chroot-fs

You can store the chroot wherever you like. I choose to store it in a disk-image which I mount to my filesystem.

@FiloSottile
FiloSottile / 32.asm
Last active May 16, 2024 19:56
NASM Hello World for x86 and x86_64 Intel Mac OS X (get yourself an updated nasm with brew)
; /usr/local/bin/nasm -f macho 32.asm && ld -macosx_version_min 10.7.0 -o 32 32.o && ./32
global start
section .text
start:
push dword msg.len
push dword msg
push dword 1
mov eax, 4
@n3wtron
n3wtron / simple_mjpeg_streamer_http_server
Last active December 22, 2023 13:32
Simple Python Motion Jpeg (mjpeg server) from webcam. Using: OpenCV,BaseHTTPServer
#!/usr/bin/python
'''
Author: Igor Maculan - n3wtron@gmail.com
A Simple mjpg stream http server
'''
import cv2
import Image
import threading
from BaseHTTPServer import BaseHTTPRequestHandler,HTTPServer
from SocketServer import ThreadingMixIn
@stormwild
stormwild / script.js
Created December 8, 2012 02:50
Immediately-Invoked Function Expression (IIFE) / (jQuery Self Executing Closure Pattern) and other useful javascript snippets
// “self-executing anonymous function” (or self-invoked anonymous function)
// Reference: http://stackoverflow.com/questions/188663/jquery-javascript-design-self-executing-function-or-object-literal
;(function($) {
var myPrivateFunction = function() {
};
var init = function() {
@jtan189
jtan189 / JavaPasswordSecurity.java
Created September 29, 2012 15:10
Java PBKDF2 Password Hashing Code
import java.security.SecureRandom;
import javax.crypto.spec.PBEKeySpec;
import javax.crypto.SecretKeyFactory;
import java.math.BigInteger;
import java.security.NoSuchAlgorithmException;
import java.security.spec.InvalidKeySpecException;
/*
* PBKDF2 salted password hashing.
* Author: havoc AT defuse.ca