Skip to content

Instantly share code, notes, and snippets.

@jpmens
jpmens / bash_prompt_fancy.sh
Created June 8, 2018 23:54 — forked from tom--/bash_prompt_fancy.sh
A fancy bash prompt. Put it in your .bashrc
red=$(tput setaf 1)
green=$(tput setaf 2)
yellow=$(tput setaf 3)
bold=$(tput bold)
dim=$(tput dim)
off=$(tput sgr0)
thumb () {
case $1 in
0) printf "\xF0\x9F\x91\x8d" ;;
*) printf "\xF0\x9F\x91\x8e $red($1)$off" ;;
#!/bin/bash
modprobe -r ec_sys
modprobe ec_sys write_support=1
on="\x8a"
off="\x0a"
led(){
echo -n -e $1 | dd of="/sys/kernel/debug/ec/ec0/io" bs=1 seek=12 count=1 conv=notrunc 2> /dev/null
@jpmens
jpmens / beanstalkd.service
Created January 29, 2018 07:19 — forked from ifduyue/beanstalkd.service
Install beanstalkd on CentOS 7
[Unit]
Description=Beanstalkd is a simple, fast work queue
[Service]
User=nobody
Restart=always
RestartSec=500ms
ExecStart=/usr/local/bin/beanstalkd -b /var/lib/beanstalkd
LimitNOFILE=10240
@jpmens
jpmens / tweepyfollowers.py
Created September 20, 2017 17:38 — forked from koehntopp/tweepyfollowers.py
Tweepy test: Check for posters with hashtag that follow a certain user and block them
# Tweepy API documentation: http://docs.tweepy.org/en/latest/index.html
# Vorher mit 'pip install tweepy' Tweepy installieren
# Twitter App registrieren unter https://apps.twitter.com/
import tweepy
auth = tweepy.OAuthHandler("Consumer Key (API Key)", "Consumer Secret (API Secret)")
auth.set_access_token("Access Token", "Access Token Secret")
We can make this file beautiful and searchable if this error is corrected: Unclosed quoted field in line 7.
domain,ttl,aaaa-ttl,cname-ttl,miltiple-ttls,ns-root,ns-ttl,a-count,aaaa-count,a-records,aaaa-records,ns-records,cname
facebook.com,300,300,,false,facebook.com,128517,1,1,"31.13.66.36","2a03:2880:f113:83:face:b00c:0:25de","a.ns.facebook.com.,b.ns.facebook.com.",
twitter.com,300,,,false,dynect.net,42239,4,0,"199.16.156.102,199.16.156.198,199.16.156.70,199.16.156.230","","ns1.p34.dynect.net.,ns3.p34.dynect.net.,ns4.p34.dynect.net.,ns2.p34.dynect.net.",
google.com,300,300,,false,google.com,128501,1,1,"216.58.209.14","2a00:1450:4017:803:0:0:0:200e","ns3.google.com.,ns4.google.com.,ns1.google.com.,ns2.google.com.",
youtube.com,300,300,,false,google.com,128505,1,1,"216.58.209.206","2a00:1450:4017:803:0:0:0:200e","ns3.google.com.,ns4.google.com.,ns1.google.com.,ns2.google.com.",
wordpress.org,600,,,false,wordpress.org,54943,2,0,"66.155.40.249,66.155.40.250","","ns4.wordpress.org.,ns3.wordpress.org.,ns1.wordpress.org.,ns2.wordpress.org.",
linkedin.com,300,300,,false,dynect.net,47775,1,1,"108.174.10.10","2620:109:c002:
@jpmens
jpmens / Particle-Core MQTT template.ino
Created September 7, 2016 10:49 — forked from edwios/Particle-Core MQTT template.ino
Maintain MQTT connection even after network disconnects/reconnects
// This #include statement was automatically added by the Particle IDE.
#include "MQTT/MQTT.h"
#define RECONNECT 15*1000
#define CLIENT_NAME "MagicLight-Spark"
byte server[] = { 10,0,1,250 };
MQTT client(server, 1883, callback);
bool init = true;
@jpmens
jpmens / ESP8266httpsUpdate.ino
Created April 22, 2016 15:11 — forked from igrr/ESP8266httpsUpdate.ino
ESP8266 ota over HTTPS
/*
OTA update over HTTPS
As an example, we download and install ESP8266Basic firmware from github.
Requires latest git version of the core (November 17, 2015)
Created by Ivan Grokhotkov, 2015.
This example is in public domain.
*/
@jpmens
jpmens / gist:c27f043eca97235833ca8f73346c0555
Created April 9, 2016 15:54 — forked from binarybucks/gist:fa32b0988aa7e209a9ee
Particle Photon HTU21D temperature/humidity sensor readings to MQTT
// This #include statement was automatically added by the Particle IDE.
#include "MQTT/MQTT.h"
#include "HTU21D/HTU21D.h"
int mqtt_port = 1883;
byte mqtt_host[] = { 192,168,1,4 };
String device_id = System.deviceID();
String mqtt_topic_temp = "sensors/"+ device_id + "/temp";
String mqtt_topic_humidty = "sensors/" + device_id + "/humidity";
@jpmens
jpmens / wemos_mhz14.ino
Created April 8, 2016 10:26 — forked from bembu/wemos_mhz14.ino
Wemos D1 Mini + MH-Z14 + SoftwareSerial
#include <SoftwareSerial.h>
#include <ESP8266WiFi.h>
#include <ESP8266mDNS.h>
#include <ArduinoOTA.h>
#include <SoftwareSerial.h>
#include <Ticker.h>
const char* ssid = "Bembun";
const char* password = "ananasakaama";
@jpmens
jpmens / Adafruit_GPS.cpp
Created December 20, 2015 20:40 — forked from dmiddlecamp/Adafruit_GPS.cpp
Spark GPS demo with Adafruit Ultimate GPS breakout
/***********************************
This is our GPS library
Adafruit invests time and resources providing this open source code,
please support Adafruit and open-source hardware by purchasing
products from Adafruit!
Written by Limor Fried/Ladyada for Adafruit Industries.
BSD license, check license.txt for more information
All text above must be included in any redistribution