Skip to content

Instantly share code, notes, and snippets.

@ibrahima
ibrahima / pre-commit
Last active Aug 9, 2018 — forked from jamtur01/pre-commit
A Terraform validation and formatting pre-commit hook
View pre-commit
#!/usr/bin/env bash
set -e
# Formats any *.tf files according to the hashicorp convention
files=$(git diff --cached --name-only --diff-filter=d)
for f in $files
do
if [ -e "$f" ] && [[ $f == *.tf ]]; then
terraform fmt -check=true $f
fi
@ibrahima
ibrahima / CodeBlock.jsx
Last active Dec 3, 2020
Syntax highlighting for react-markdown
View CodeBlock.jsx
import React from 'react';
import PropTypes from 'prop-types';
import SyntaxHighlighter from 'react-syntax-highlighter';
export default class CodeBlock extends React.PureComponent {
static propTypes = {
value: PropTypes.string.isRequired,
language: PropTypes.string,
}
@ibrahima
ibrahima / sample.html.slim
Created Jul 28, 2016
A sample slim template that causes slim-lint to report errors on the wrong lines
View sample.html.slim
- provide :title, 'Title'
- provide :viewport, 'desktop'
= render 'partials/sidebar'
- action_bar do
div.action-bar-label
= fa_icon('spinner', class: 'fa-spin')
| Loading...
View flycheck-fix-scss-property-sort-order.el
(defun flycheck-fix-css-property-sort-order ()
"Fixes SCSS-lint property sort order errors in the current buffer."
(interactive)
(cl-loop for error in flycheck-current-errors
do
(fix-css-property-order error))
)
(defun correct-property-order (err)
"Extracts correct CSS property order out of ERR."
View goto-student-feedback.el
(defun goto-student-feedback ()
(interactive)
(string-match
(rx (group "hw" digit) (any ascii) (group "cs30f" (1+ alpha)))
(buffer-file-name))
(let* (
(hwnum (match-string 1 (buffer-file-name)))
(username (match-string 2 (buffer-file-name)))
(feedback-path (concat "/home/linux/ieng6/cs30f/public/" hwnum "_feedback/style_feedback_" username))
@ibrahima
ibrahima / dash-listen-3.py
Last active Jul 14, 2017
Amazon Dash Button ARP listener script (not written by me)
View dash-listen-3.py
import socket
import struct
import binascii
# Written by Bob Steinbeiser (https://medium.com/@xtalker)
rawSocket = socket.socket(socket.AF_PACKET, socket.SOCK_RAW,
socket.htons(0x0003))
MAC = '74c24671971c'
View build.prop
# begin build properties
# autogenerated by buildinfo.sh
ro.build.id=JZO54K
ro.build.display.id=JZO54K.N8010XXUCMK2
ro.build.version.incremental=N8010XXUCMK2
ro.build.version.sdk=16
ro.build.version.codename=REL
ro.build.version.release=4.1.2
ro.build.date=Wed Nov 20 16:29:39 KST 2013
ro.build.date.utc=1384932579
View radio2.log
E/use-Rlog/RLOG-RILD( 300): **RIL Daemon Started**
E/use-Rlog/RLOG-RILD( 300): **RILd param count=1**
E/use-Rlog/RLOG-RIL( 311): loadOpnameStaticTable(): count(1101)
E/use-Rlog/RLOG-RIL( 311): OemInitGprsData()
E/use-Rlog/RLOG-RIL( 311): deactivate_virtual_inet()
E/use-Rlog/RLOG-RIL( 311): deactivate_virtual_inet() : unknown pdp type () down all interface
E/use-Rlog/RLOG-RIL( 311): setting addr for rmnet0: 0
E/use-Rlog/RLOG-RIL( 311): intfconf_set_flags()
E/use-Rlog/RLOG-RIL( 311): intfconf_clear_addr_ipv6()
E/use-Rlog/RLOG-RIL( 311): intfconf_init_ifr_ipv6()
View radiogood.log
I/use-Rlog/RLOG-RILC( 327): qmi_ril(0/327): [cmd-22(144)] qcril_qmi_nas_util_convert_nas_srv_status_to_ril_reg_status: ... is voice supported on lte dyn 1, setting 0
I/use-Rlog/RLOG-RILC( 327): qmi_ril(0/327): [cmd-22(144)] qcril_qmi_nas_is_in_service_of_technology: .. param 1
I/use-Rlog/RLOG-RILC( 327): qmi_ril(0/327): [cmd-22(144)] qcril_qmi_nas_is_in_service_of_technology: .. cache valid 0
I/use-Rlog/RLOG-RILC( 327): qmi_ril(0/327): [cmd-22(144)] qcril_qmi_nas_util_convert_nas_srv_status_to_ril_reg_status: ... is voice supported on lte dyn 1, setting 0
D/use-Rlog/RLOG-RIL-QMI( 375): qmuxd: RX 47 bytes on fd=23 from qmux_client_id=b
E/use-Rlog/RLOG-RIL-RAWDATA( 375): service_ID = 3, message_ID = 4d
E/use-Rlog/RLOG-RIL-RAWDATA( 375): 01 0C 00 00 03 01 00 2A 00 4D 00 ..
E/use-Rlog/RLOG-RIL-QMI( 375): [SMDPORT] >> BEFORE, Write SMD Port [fd = 10] [msg_len = 13]
E/use-Rlog/RLOG-RIL-QMI( 375): [SMDPORT] << AFTER, Write SMD Port [rc = 0]
D/RILJ ( 1094): [3795]> DATA_REGISTRATION_STATE
View rotationcrash
E/Sensors (11896): poll() failed (Interrupted system call)
E/Sensors (11896): poll() failed (Interrupted system call)
W/Watchdog(11896): *** WATCHDOG KILLING SYSTEM PROCESS: Blocked in monitor com.android.server.wm.WindowManagerService on foreground thread (android.fg), Blocked in handler on ui thread (android.ui), Blocked in handler on WindowManager thread (WindowManager)
W/Watchdog(11896): foreground thread stack trace:
W/Watchdog(11896): at com.android.server.wm.WindowManagerService.monitor(WindowManagerService.java:10704)
W/Watchdog(11896): at com.android.server.Watchdog$HandlerChecker.run(Watchdog.java:147)
W/Watchdog(11896): at android.os.Handler.handleCallback(Handler.java:733)
W/Watchdog(11896): at android.os.Handler.dispatchMessage(Handler.java:95)
W/Watchdog(11896): at android.os.Looper.loop(Looper.java:137)
W/Watchdog(11896): at android.os.HandlerThread.run(HandlerThread.java:61)