Skip to content

Instantly share code, notes, and snippets.

@HackToHell
HackToHell / main.go
Created May 20, 2024 21:15
Split each block of terraform hcl2 into individual files
package main
import (
"flag"
"fmt"
"github.com/hashicorp/hcl/v2"
"os"
"path/filepath"
"github.com/hashicorp/hcl/v2/hclwrite"
@HackToHell
HackToHell / main.py
Created May 1, 2019 12:20
Simple Mi Air Purifier 2 prometheus exporter
import os
from prometheus_client.core import GaugeMetricFamily, REGISTRY
from miio.airpurifier import AirPurifier
from prometheus_client.metrics_core import CounterMetricFamily
from prometheus_client.twisted import MetricsResource
from twisted.web.server import Site
from twisted.web.resource import Resource
from twisted.internet import reactor
@HackToHell
HackToHell / Gopkg.lock
Created October 23, 2017 17:29
k8s errors
# This file is autogenerated, do not edit; changes may be undone by the next 'dep ensure'.
[[projects]]
name = "github.com/PuerkitoBio/purell"
packages = ["."]
revision = "0bcb03f4b4d0a9428594752bd2a3b9aa0a9d4bd4"
version = "v1.1.0"
[[projects]]
@HackToHell
HackToHell / datawritten.sh
Created March 19, 2017 13:58
Script to get the amount of data written to the Samsung EVO 850 SSD
sudo smartctl -A /dev/sdb | awk '/^241/ { print "TBW: "($10 * 512) * 1.0e-12, "TB" } '
@HackToHell
HackToHell / launch.sh
Created January 11, 2017 14:15
Insurgency and TF2 launch args for Arch Linux and bumblebee
vblank_mode=0 LD_PRELOAD='/usr/$LIB/libstdc++.so.6 /usr/$LIB/libgcc_s.so.1 /usr/$LIB/libxcb.so.1 /usr/$LIB/libgpg-error.so' optirun -b primus %command%
@HackToHell
HackToHell / export.py
Created September 17, 2016 04:56
Phabricator Phriction documentation exporter script
import pandas as pd
import os
from sqlalchemy import *
engine = create_engine('mysql://root:test@127.0.0.1/test') #Change me to the phriction database
df=pd.read_sql('select * from phriction_content',engine)
def get(x):
x=x.iloc[0]
@HackToHell
HackToHell / WhatsappChat backup txt parser.py
Created June 6, 2016 16:57
Makes the text into a csv
fp = open('C:/Users/Gowtham/Downloads/WhatsApp Chat with xxxx.txt','r')
text = fp.readlines()
text = [line.rstrip('\n') for line in text]
import csv
with open('names.csv', 'w') as csvfile:
fields = ['time','Name','Text']
writer = csv.DictWriter(csvfile, fieldnames=fields)
writer.writeheader()
city Population zip state lat lng
Indianapolis 798,382 46201 IN 39.775006 -86.109348
Indianapolis 798,382 46202 IN 39.785063 -86.159502
Indianapolis 798,382 46203 IN 39.743025 -86.117859
Indianapolis 798,382 46204 IN 39.771986 -86.153491
Indianapolis 798,382 46205 IN 39.826761 -86.138582
Indianapolis 798,382 46208 IN 39.829905 -86.179444
Indianapolis 798,382 46218 IN 39.80817 -86.101425
Indianapolis 798,382 46219 IN 39.782092 -86.049533
Indianapolis 798,382 46220 IN 39.864685 -86.11815
@HackToHell
HackToHell / auresult.py
Last active November 17, 2015 10:11
Anna University result scraper
# coding: utf-8
# In[30]:
import csv
# In[59]:
import requests