This is a fairly common question, and there isn't a One True Answer.
These are the most common techniques:
#if _WIN32_WINNT < 0x0500 | |
# error "should be NT" | |
#endif | |
#include <windows.h> | |
#include <tlhelp32.h> | |
#include <winternl.h> | |
#include <stdio.h> | |
DWORD getppid() | |
{ |
private static byte[] intToLittleEndian(long numero) { | |
ByteBuffer bb = ByteBuffer.allocate(4); | |
bb.order(ByteOrder.LITTLE_ENDIAN); | |
bb.putInt((int) numero); | |
return bb.array(); | |
} | |
// OR ... | |
private static byte[] intToLittleEndian(long numero) { |
package com.ayosec.misc; | |
import com.sun.jna.*; | |
public class LibC { | |
public interface Handle extends Library { | |
Handle module = (Handle) Native.loadLibrary("c", Handle.class); | |
int getpid(); |
In one of my pet projects, I redirect all requests to index.php, which then decides what to do with it:
This snippet in your .htaccess will ensure that all requests for files and folders that does not exists will be redirected to index.php:
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-d
#! /bin/sh | |
# Copyright (c) 2012 Bryan Drewery <bryan@shatow.net> | |
# All rights reserved. | |
# | |
# Redistribution and use in source and binary forms, with or without | |
# modification, are permitted provided that the following conditions | |
# are met: | |
# 1. Redistributions of source code must retain the above copyright | |
# notice, this list of conditions and the following disclaimer | |
# in this position and unchanged. |
#include <time.h> | |
#include <stdio.h> | |
#include <stdlib.h> | |
int main () { | |
time_t time_num[5] = {(time_t)0x00000000, (time_t)0x7fffffff, (time_t)0x80000000, (time_t)0xffffffff,}; | |
struct tm* parsed_time; unsigned int i; | |
printf("sizeof(time_t) is %d.\n", sizeof(time_t)); | |
for (i = 0; i < 4; i++) { | |
parsed_time = gmtime(&(time_num[i])); |
##git mergetool
In the middle file (future merged file), you can navigate between conflicts with ]c
and [c
.
Choose which version you want to keep with :diffget //2
or :diffget //3
(the //2
and //3
are unique identifiers for the target/master copy and the merge/branch copy file names).
:diffupdate (to remove leftover spacing issues)
:only (once you’re done reviewing all conflicts, this shows only the middle/merged file)
Let's say you start a project locally, and do some editing.
$ mkdir -p ~/git/foo && cd ~/git/foo
$ touch NEWFILE
Now you decide you want to create a new github repo and track it, but the directory is non-empty so git won't let you clone into it. You can fix this, thusly:
I recently had the following problem:
We didn't want to open the MySQL port to the network, but it's possible to SSH from the Jenkins machine to the MySQL machine. So, basically you would do something like
ssh -L 3306:localhost:3306 remotehost