Skip to content

Instantly share code, notes, and snippets.

@hz9xa
hz9xa / notebook fan noise after wake up
Created September 12, 2013 05:14
The script fix fan noise after wakeup in linux
Hi, using kernel 3.8.0-23-generic, 'normal' ubuntu 13.04, HP6830s and an older HP laptop of which I don't know by heart the model, same problem.
I modified the script a little; I presume it will work on all laptops like this since it does for mine:
nano /etc/pm/sleep.d/99fancontrol.sh
#!/bin/bash
#
#
@hz9xa
hz9xa / new_gist_file
Created August 15, 2013 01:25
Floating Point to Binary Value(C++)
#include <iostream>
#include <bitset>
int main()
{
union
{
float input; // assumes sizeof(float) == sizeof(int)
int output;
} data;
@hz9xa
hz9xa / new_gist_file
Created August 15, 2013 00:27
warning: deprecated conversion from string constant to ‘char*’ #Cprogramming
warning: deprecated conversion from string constant to ‘char*’
The correct way to fix this is to find every declaration like
char *s = "constant string";
or function call like:
void foo(char *s);
@hz9xa
hz9xa / new_gist_file
Created August 11, 2013 22:13
#Git; initialize a nonempty git repository
cd <localdir>
git init
git add .
git commit -m 'message'
git remote add origin <url>
git push -u origin master
@hz9xa
hz9xa / backspace
Created August 11, 2013 07:34
#Backspace #delete Fixe the broken backspace key
Backspace key is supposed to send Control+H or ^H,
however, the terminal may show ^? and do not delete anything
To fix this, change terminal settings and force ^H to be send for backspace key
@hz9xa
hz9xa / Short cuts
Created July 15, 2013 01:36
CMD here
CMD here:
Shift + Menu
w
enter
@hz9xa
hz9xa / python
Created July 4, 2013 22:16
python utilities
'{0:04x}'.format(6) //{} will replace it with variable
// convert from decimal to hex
@hz9xa
hz9xa / for loop in shell
Created July 3, 2013 18:24
Check file size in Linux delete files older than xmins/x days do not overwrite environment variable in makefile modify prompt
for (( i=0; i<=5; i++ ))
do
...
done