Skip to content

Instantly share code, notes, and snippets.

View p3x-robot's full-sized avatar
🦝
LOL - opening the sources ...

patrikx3 p3x-robot

🦝
LOL - opening the sources ...
View GitHub Profile
@devernay
devernay / noscreensaver.sh
Created May 6, 2020 18:39
Move mouse to prevent screensaver from activating & locking (wiggleme)
#!/bin/bash
# https://www.darklaunch.com/move-mouse-to-prevent-screensaver-from-activating-locking
case $(uname -s) in
Darwin)
timeout=$((10 * 60))
while :; do
last_mouse_position=$(cliclick "p")
sec="${timeout}"
while [[ $sec -ge 0 ]]; do
@ckimrie
ckimrie / example.component.ts
Last active December 12, 2023 20:53
Example on how to achieve RxJS observable caching and storage in Angular 2+. Ideal for storing Http requests client side for offline usage.
import { Component, OnInit, OnDestroy } from '@angular/core';
import {Http} from "@angular/http";
import { LocalCacheService } from "./local-cache.service";
@Component({
selector: 'app-example',
templateUrl: './app.component.html',
styleUrls: ['./app.component.scss']
})
export class ExampleComponent implements OnInit, OnDestroy {
@cristoferdomingues
cristoferdomingues / index.html
Created April 13, 2017 19:27
Angular DOM Mutation Observer
<!DOCTYPE html>
<html>
<head>
<script data-require="angular.js@1.2.4" data-semver="1.2.4" src="http://code.angularjs.org/1.2.4/angular.js"></script>
<link rel="stylesheet" href="style.css" />
<script src="script.js"></script>
</head>
<body ng-app="myApp">
@Pysis868
Pysis868 / grub.cfg
Last active February 25, 2024 06:41
My own configuration file for GRUB2 to boot various live distributions of Linux-based operating systems, along with some system tools. I tried to include a lot of sample configuration entries, even if I don't currently use them, so it may help others. Exceedingly long blog post: http://tehfishyblog.logdown.com/chips/306146-a-homemade-ultimate-bo…
# Config for GNU GRand Unified Bootloader (GRUB) (2)
# /boot/grub2/grub.cfg
# or
# /boot/grub/grub.cfg
# Mostly only 'legacy' CSM/BIOS boot methods currently.
# Unable to boot loop entries with Secure Boot
# Notes:
# Description:
# This grub.cfg file was created by Lance http://www.pendrivelinux.com
@wmealing
wmealing / C-states.md
Last active March 29, 2024 22:51
What are CPU "C-states" and how to disable them if needed?

To limit a CPU to a certain C-state, you can pass the processor.max_cstate=X option in the kernel line of /boot/grub/grub.conf.

Here we limit the system to only C-State 1:

    kernel /vmlinuz-2.6.18-371.1.2.el5 ... processor.max_cstate=1

On some systems, the kernel can override the BIOS setting, and the parameter intel_idle.max_cstate=0 may be required to ensure sleep states are not entered:

@laurenorsini
laurenorsini / MakeOpenVPN.sh
Last active September 14, 2023 19:58
MakeOpenVPN.sh by Eric Jodoin
#!/bin/bash
# Default Variable Declarations
DEFAULT="Default.txt"
FILEEXT=".ovpn"
CRT=".crt"
KEY=".3des.key"
CA="ca.crt"
TA="ta.key"
#include <unistd.h>
#include <node.h>
#include <string.h>
#include <v8.h>
using namespace v8;
unsigned long long count = 0;
// native blocking/compute intensive function
@skaag
skaag / limt_req_zone_whitelist
Created March 12, 2014 19:17
A way to whitelist certain IP ranges from limit_req_zone in nginx
geo $limited {
default 1;
# Wordpress Jetpack ranges:
192.0.0.0/16 0;
66.135.0.0/16 0;
66.155.0.0/16 0;
76.74.0.0/16 0;
}
@aseemk
aseemk / randomStr.js
Created July 12, 2012 05:00
Random alphanumeric (base-62) strings in Node.js, cryptographically strong
var bases = require('bases');
var crypto = require('crypto');
// Returns a base-62 (alphanumeric only) string of the given length:
function randomStr(length) {
// We generate a random number in a space at least as big as 62^length,
// and if it's too big, we just retry. This is still statistically O(1)
// since repeated probabilities less than one converge to zero. Hat-tip to
// a Google interview for teaching me this technique! ;)
@mshafrir
mshafrir / states_hash.json
Created May 9, 2012 17:05
US states in JSON form
{
"AL": "Alabama",
"AK": "Alaska",
"AS": "American Samoa",
"AZ": "Arizona",
"AR": "Arkansas",
"CA": "California",
"CO": "Colorado",
"CT": "Connecticut",
"DE": "Delaware",